/**
 * @date 2006-7-27 17:19:19
 *
 */
package org.nanhill.moo.service.impl;

import org.nanhill.moo.config.Configurable;
import org.nanhill.moo.config.Configuration;

/**
 * @author alin [xalinx at gmail dot com]
 * 
 */
public abstract class AbstractService {

	protected final static Configurable CONFIG = Configuration.getInstance();

	/**
	 * @param cache
	 * @param cacheTime
	 * @param cacheMeanTime
	 * @return rebuild cache time, -1 if need not rebuild, else return new cache
	 *         time.
	 */
	// protected long rebuildCacheTime(Object cache, long cacheTime,
	// long cacheMeanTime) {
	// long nowtime = System.currentTimeMillis();
	// return (cache == null || nowtime - cacheTime > cacheMeanTime) ? nowtime
	// : -1;
	// }
	//
	// protected boolean needRebuild(long rebuildCacheTime) {
	// return -1 != rebuildCacheTime;
	// }

	// protected final void rebuildServiceCache(MeantimeCache cache) {
	// long nowtime = System.currentTimeMillis();
	// if (cache.isEmpty()
	// || nowtime - cache.getCacheTime() > cache.getCacheMeantime()) {
	// cache.setCacheTime(nowtime);
	// cache.rebuild();
	// }
	// }

}
